package com.sixteengroup.personnelms.service.admin;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.sixteengroup.personnelms.bean.Performance;
import com.sixteengroup.personnelms.bean.User;
import com.sixteengroup.personnelms.dao.admin.PerformanceDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PerformanceService {
    @Autowired
    PerformanceDao performanceDao;

    public PageInfo<Performance> getList(Performance performance) {
        //分页插件  只要传递当前页数和页数大小  自动计算，并查询总条数
        PageHelper.startPage(performance.getCurrentPage(), performance.getPagesize());
        List<Performance> performanceList = performanceDao.getPerList(performance);
        PageInfo<Performance> page = new PageInfo<>(performanceList);
        return page;
    }

    public void delete(Integer id) {
        performanceDao.delete(id);
    }


    public List<User> getKhrs() {
        return performanceDao.getKhrs();
    }

    public List<User> getBkhrs() {
        return performanceDao.getBkhrs();
    }

    public void save(Performance per) {
        performanceDao.save(per);
    }

    public Performance getPerById(Integer id) {
        return performanceDao.getPerById(id);
    }

    public void update(Performance per) {
        performanceDao.update(per);
    }
}
